package cn.melon.view.admin.library.ctr;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import cn.melon.mod.library.LibraryBooksInfo;
import cn.melon.mod.library.LibraryRequest;
import cn.melon.view.admin.library.BookInfoDialog;
import cn.melon.view.admin.library.IUpdateBookTable;

public class LIbraryBookInfoCtr implements ActionListener {

    
    private BookInfoDialog dialog = null;
    
    
    private LibraryRequest libraryRequest;
    public LIbraryBookInfoCtr(BookInfoDialog dig, IUpdateBookTable updateBookTable){
        this.dialog = dig;
        libraryRequest = new LibraryRequest(updateBookTable);
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {
        switch (e.getActionCommand()) {
        case "保存":
            LibraryBooksInfo booksInfo = dialog.getBookInfo();
            libraryRequest.updateInfo(booksInfo);
            dialog.setVisible(false);
            break;
        case "取消":
            dialog.setVisible(false);
            break;
        default:
            break;
        }

    }

}
